package pierwszy;

import org.openqa.selenium.NoSuchWindowException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;

import pierwszy.NoteContentPageUiMapping;

public class NoteContentPage extends Note{
	private WebDriver driver;
	private WebDriverWait wait;
	private String noteContentPageHeader = "Notka (szczegóły notki)";
	
	NoteContentPage(WebDriver driver, WebDriverWait wait){
		super(driver, wait);
		this.driver = driver;
		this.wait = wait;

		if(!getNoteContentPageHeader().getText().equals(noteContentPageHeader)){
			throw new NoSuchWindowException("This is not the NoteContent page");
		}	
		
//		if(!getIconPlusText().getText().equals(KsPDKPage.iconPlusOptionsMap.get("Notkę"))){
//			throw new NoSuchWindowException("This is not the Note page");
//		}
	}
	
	public NotesListPage goBackToNotesList(){
		WebElement powrot = driver.findElement(NoteContentPageUiMapping.powrotBtn);
		powrot.click();
		
		return new NotesListPage(driver, wait);
	}
	
	//getters
	public WebElement getNoteContentPageHeader(){
		return driver.findElement(NoteContentPageUiMapping.noteContentPageHeader);
	}
	
	public WebElement getNoteType(){
		return driver.findElement(NoteContentPageUiMapping.noteType);
	}
	
	public WebElement getNoteText(){
		return driver.findElement(NoteContentPageUiMapping.noteText);
	}
	
	public WebElement getNoteAutor(){
		return driver.findElement(NoteContentPageUiMapping.noteAutor);
	}
	
	public WebElement getNoteDateTime(){
		return driver.findElement(NoteContentPageUiMapping.noteDateTime);
	}
	

}
